<?php
@header('Content-Type:text/html;charset=utf-8'); 
session_start();
@require_once('config.php');
@require_once('oauth.php');
@require_once('opent.php');
@require_once('api_client.php');

$o = new MBOpenTOAuth( MB_AKEY , MB_SKEY , $_SESSION['app_key_tencent']['oauth_token'] , $_SESSION['app_key_tencent']['oauth_token_secret']  );
$last_key = $o->getAccessToken(  $_REQUEST['oauth_verifier'] ) ;//获取ACCESSTOKEN
$_SESSION['last_key_tencent'] = $last_key;

$c = new MBApiClient( MB_AKEY , MB_SKEY , $_SESSION['last_key_tencent']['oauth_token'] , $_SESSION['last_key_tencent']['oauth_token_secret']);
$user   = $c->getUserInfo(false);
$_SESSION['weibo']['tencent']   = $user;
header('Location: http://'.$_SERVER['HTTP_HOST']. '/home/tencent_login/');
?>